<template>
    <div class='checkout_list'>
        <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane :label="glName" name="first" style="overflow:hidden">
                <table style="table-layout:fixed;width:100%;height:100%;border:1px solid #ddd;border-collapse:collapse" cellspacing="0" >
                    <colgroup>
                        <col style="width:30px"/>
                        <col style="width:230px"/>
                        <col style="width:100px"/>
                        <col style="width:100px"/>
                        <col style="width:80px"/>
                        <col style="width:80px" v-if="isShowJm=='Y'"/>
                        <col style="width:80px" v-if="isShowJm=='Y'"/>
                        <col style="width:80px"/>
                        <col style="width:100px"/>
                        <col/>
                    </colgroup>
                    <tr>
                        <td class="tds"><input type='checkbox' v-model="checkAll" @click="selectall1(glJson2)"/></td>
                        <td class="tds">{{glName}}</td>
                        <td class="tds">数量</td>
                        <td class="tds">金额</td>
                        <td class="tds"  v-if="isShowJm=='Y'">减免</td>
                        <td class="tds"  v-if="isShowJm=='Y'">优惠</td>
                        <td class="tds">未收</td>
                        <td class="tds">已收</td>
                        <td class="tds">实收</td>
                    </tr>
                    <tr v-for="(item,index) in glJson2" :key="index">
                       <td class="tds"><input type='checkbox' @click="select1(item,index)" :checked="fruitIdss.indexOf('a'+index)>=0"/></td>
                       <td class="tds">{{item.szi_ex1}}</td>
                       <td class="tds">{{item.num}}</td>
                       <td class="tds">{{item.amt_ys}}</td>
                       <td class="tds" v-if="isShowJm=='Y'">{{item.szi_ex35s}}</td>
                       <td class="tds" v-if="isShowJm=='Y'">{{item.szi_ex27||item.szi_ex27s}}</td>
                       <td class="tds">{{item.amt_total2}}</td>
                       <td class="tds">{{item.amt_ys2}}</td>
                       <td class="tds"><input type='text' v-model="item.amt_total" style='border:0;width:90px;'/></td>
                       <td>&nbsp;</td>
                    </tr>
                </table>
                
            </el-tab-pane>
            <el-tab-pane :label="gsName" name="first2" style="overflow:hidden" v-if="isShowGsxm=='Y'">
                <table style="table-layout:fixed;width:100%;height:100%;border:1px solid #ddd;border-collapse:collapse" cellspacing="0" >
                    <colgroup>
                        <col style="width:30px"/>
                        <col style="width:230px"/>
                        <col style="width:100px"/>
                        <col style="width:100px"/>
                        <col style="width:80px"/>
                        <col style="width:80px" v-if="isShowJm=='Y'"/>
                        <col style="width:80px" v-if="isShowJm=='Y'"/>
                        <col style="width:80px"/>
                        <col style="width:100px"/>
                        <col/>
                    </colgroup>
                    <tr>
                        <td class="tds"><input type='checkbox' v-model="checkAll" @click="selectall2(gsJson2)"/></td>
                        <td class="tds">{{gsName}}</td>
                        <td class="tds">数量</td>
                        <td class="tds">金额</td>
                        <td class="tds"  v-if="isShowJm=='Y'">减免</td>
                        <td class="tds"  v-if="isShowJm=='Y'">优惠</td>
                        <td class="tds">未收</td>
                        <td class="tds">已收</td>
                        <td class="tds">实收</td>
                    </tr>
                    <tr v-for="(item,index) in gsJson2" :key="index">
                       <td class="tds"><input type='checkbox' @click="select2(item,index)" :checked="fruitIdss2.indexOf('a'+index)>=0"/></td>
                       <td class="tds">{{item.szi_ex1}}</td>
                       <td class="tds">{{item.num}}</td>
                       <td class="tds">{{item.amt_ys}}</td>
                       <td class="tds" v-if="isShowJm=='Y'">{{item.szi_ex35s}}</td>
                       <td class="tds" v-if="isShowJm=='Y'">{{item.szi_ex27||item.szi_ex27s}}</td>
                       <td class="tds">{{item.amt_total2}}</td>
                       <td class="tds">{{item.amt_ys2}}</td>
                       <td class="tds"><input type='text' v-model="item.amt_total" style='border:0;width:90px;'/></td>
                       <td>&nbsp;</td>
                    </tr>
                </table>
                
            </el-tab-pane>
            <el-tab-pane label="已结账项目" name="second">
                <table style="table-layout:fixed;width:100%;height:100%;border:1px solid #ddd;border-collapse:collapse" cellspacing="0" >
                    <colgroup>
                        <col style="width:230px"/>
                        <col style="width:100px"/>
                        <col style="width:100px"/>
                        <col style="width:80px" v-if="isShowJm=='Y'"/>
                        <col style="width:80px" v-if="isShowJm=='Y'"/>
                        <col style="width:80px"/>
                        <col style="width:130px"/>
                        <col v-if="sCode!='lygrwy'" style="width:120px" />
                        <col/>
                    </colgroup>
                     <tr>
                      
                        <td class="tds">项目名称</td>
                        <td class="tds">数量</td>
                        <td class="tds">应收</td>
                        <td class="tds"  v-if="isShowJm=='Y'">减免</td>
                        <td class="tds"  v-if="isShowJm=='Y'">优惠</td>
                        <td class="tds">金额</td>
                        <td class="tds">结算日期</td>

                        <td class="tds" v-if="sCode!='lygrwy'">发票号</td>
                    </tr>
                    <tr v-for="(item,index) in jzJson" :key="index">
                        <td class="tds">{{item.szi_ex1}}</td>
                        <td class="tds">{{item.num}}</td>
                        <td class="tds">{{item.jzi_ex31}}</td>
                       <td class="tds" v-if="isShowJm=='Y'">{{item.szi_ex35s}}</td>
                       <td class="tds" v-if="isShowJm=='Y'">{{item.amt_yh}}</td>
                        <td class="tds">{{item.amt_total}}</td>
                        <td class="tds">{{item.jz_dat5s}}</td>
                        <td class="tds" v-if="sCode!='lygrwy'">{{item.jz_no}}</td>
                    </tr>
                </table>
                <!--el-table
                    :data="jzJson"
                    stripe
                    border
                    show-summary
                    ref="table2"
                    style="width: 100%;"
                    >
                      <el-table-column
                    type="selection"
                    width="30" v-if="isCheck=='Y'||isCheck=='B'">
                    </el-table-column >
                    <el-table-column
                    prop="szi_ex1"
                    :label="gsName" 
                    width="140">
                    </el-table-column>
                    <el-table-column
                    prop="num"
                    label="数量"
                    width="80">
                    </el-table-column>
                     <el-table-column
                    prop="jzi_ex31"
                    label="应收">
                    </el-table-column>
                    <el-table-column
                    prop="amt_total"
                    label="金额">
                    </el-table-column>
                    <el-table-column
                    v-if="isYh=='Y'"
                    prop="amt_yh"
                    label="优惠">
                    </el-table-column>
                     <el-table-column
                  
                    prop="amt_sh"
                    v-if="isYh=='Y'"
                    label="实收">
                   
                    </el-table-column>

                    <el-table-column
                    prop="jz_dat5s"
                    width="130"
                    label="结算日期">
                    </el-table-column>
                     <el-table-column
                    width="160"
                    prop="jz_no"
                    label="发票号">
                    </el-table-column>

                </el-table-->
            </el-tab-pane>
        </el-tabs>
       
    </div>
</template>
<script>
export default {
    name:'gm_check_out_list_complex',
    props:['data','appid','exkey','oldData'],
    components: {
    },
    data(){
        return{
            checkAll:true,
            fruitIdss:[],
            fruitIdss2:[],
            activeName:"first",
            isShowGsxm:"N",
            jzJson:[],
            glJson:[],
            gsJson:[],
            glJson2:[],
            gsJson2:[],
            gsJm:{},
            glJm:{},
            gsName:this.exkey.gsName,
            glName:this.exkey.glName,
            jz_id:'',
            yhItem:null,
            yh:"",
            isCheck:this.exkey.isCheck,
            isYh:this.exkey.isYh,
            isFirst:"Y",
            isShowJm:"Y",
            sCode:localStorage.getItem("sCode")
        }
    },
    created(){
        console.log("exkey================================");
        console.log(this.exkey)
        let sef=this;
        //this.loadData();
        window.addEventListener('message', function(messageEvent) {
            var data = messageEvent.data;
            let datas=JSON.stringify(data)
            if(datas.jz_id){
                this.jz_id=datas.jz_id;
            }
        // vue.menuTitle = data;
        },false);
        try{
            if(this.exkey&&this.exkey.isShowGsxm){
                this.isShowGsxm=this.exkey.isShowGsxm;
            }
        }catch(e){}
        this.glJson=this.data.gl;
        if(this.isShowGsxm=='Y')
            this.gsJson=this.data.gs;
        else{
            this.gsJson=[];
        }
        console.log("1selectAl==========================================================");

        
        

        console.log(this.glJm,"this.glJm==============")
        if(this.data["buyer"]["c_ex57"]!="Y")
            this.initList();

        let jzJson_=[];
        let totals=0;
        for(let i=0;i<this.data.jzs.length;i++){
            let shows=this.data.jzs[i].shows;
            let amt_total=this.data.jzs[i].amt_total;
            if(shows!="Y"){
                jzJson_.push(this.data.jzs[i])
                totals+=Number(amt_total)
            }
        }
        let jz_={
            szi_ex1:"合计",
            amt_total:totals
        }
        jzJson_.push(jz_)
        this.jzJson=jzJson_;

        this.selectAll();


        //this.loadYh();
    },
    methods:{
        initList(){
            console.log(this.glJson,"this.glSjonss====")
            this.glJm={};
            this.gsJm={};
            for(let i=0;i<this.glJson.length;i++){
                let szi_ex7=this.glJson[i].szi_ex7;
                let szi_ex1=this.glJson[i].szi_ex1;
                if(szi_ex7.indexOf("减免")!=-1){
                    this.glJm[szi_ex1]=i;
                }
            }

            for(let i=0;i<this.gsJson.length;i++){
                let szi_ex7=this.gsJson[i].szi_ex7;
                let szi_ex1=this.gsJson[i].szi_ex1;
                if(szi_ex7.indexOf("减免")!=-1){
                    this.gsJm[szi_ex1]=i;
                }
            }
            
            let glJson_=[];
            for(let i=0;i<this.glJson.length;i++){
                let shows=this.glJson[i].shows;
                let szi_ex18=this.glJson[i].szi_ex18;
                let szi_ex7=this.glJson[i].szi_ex7;
                let szi_ex27=this.glJson[i].szi_ex27;
                let szi_id=this.glJson[i].szi_id;
                try{
                    if(this.isShowJm=='Y'){
                        if(this.glJm[szi_ex18]||this.glJm[szi_ex18]==0){
                            let isOks=true;
                            for(let h=0;h<this.data.jzs.length;h++){
                                let jzi_ex1=this.data.jzs[h].jzi_ex1;
                                console.log("jzi_ex1==="+jzi_ex1+"=="+szi_ex18)
                                if(jzi_ex1==szi_ex18){
                                    isOks=false;
                                    break;
                                }
                            }
                            if(isOks){
                                this.glJson[i].szi_ex35s=this.glJson[this.glJm[szi_ex18]].szi_ex5;
                            }else{
                                this.glJson[i].szi_ex35s2=this.glJson[this.glJm[szi_ex18]].szi_ex5;
                            }
                            


                            let amt=Number(this.glJson[this.glJm[szi_ex18]].szi_ex5);
                            let amt_total=Number(this.glJson[i].amt_total);
                            let amt_total2=Number(this.glJson[i].amt_total2);
                            this.glJson[i].amt_total=amt_total+amt;
                            this.glJson[i].amt_total2=amt_total2+amt;
                        }
                    }
                }catch(e){}
                console.log("szi_ex27==============================="+szi_ex27)
                if(szi_ex27){
                    let isOks=true;
                    for(let h=0;h<this.data.jzs.length;h++){
                        let jzi_ex32=this.data.jzs[h].jzi_ex32;
                        console.log("jzi_ex32================"+jzi_ex32)
                        if(jzi_ex32==szi_id){
                            isOks=false;
                            break;
                        }
                    }
                    if(!isOks){
                        this.glJson[i].szi_ex27s=this.glJson[i].szi_ex27;
                        this.glJson[i].szi_ex27="";
                    }
                }
                if(shows!="Y"&&szi_ex7.indexOf("减免")==-1){
                    let szi_ex35s=this.glJson[i].szi_ex35s;
                    if(szi_ex35s){
                        szi_ex35s=Number(szi_ex35s);
                        let amt_ys2=this.glJson[i].amt_ys2;
                        
                        if(amt_ys2&&amt_ys2!="0"){
                            amt_ys2=Number(amt_ys2);
                            this.glJson[i].amt_ys2=amt_ys2+szi_ex35s
                        }
                        
                    }
                    glJson_.push(this.glJson[i])
                }
            }
            this.glJson2=glJson_;


            let gsJson_=[];
            for(let i=0;i<this.gsJson.length;i++){
                let shows=this.gsJson[i].shows;
                let szi_ex18=this.gsJson[i].szi_ex18;
                let szi_ex7=this.gsJson[i].szi_ex7;
                let szi_ex27=this.gsJson[i].szi_ex27;
                let szi_id=this.gsJson[i].szi_id;
                 try{
                    if(this.isShowJm=='Y'){
                        if(this.gsJm[szi_ex18]||this.gsJm[szi_ex18]==0){
                            let isOks=true;
                            for(let h=0;h<this.data.jzs.length;h++){
                                let jzi_ex1=this.data.jzs[h].jzi_ex1;
                                if(jzi_ex1==szi_ex18){
                                    isOks=false;
                                    break;
                                }
                            }
                            if(isOks)
                                this.gsJson[i].szi_ex35s=this.gsJson[this.gsJm[szi_ex18]].szi_ex5;
                            else
                                this.gsJson[i].szi_ex35s2=this.gsJson[this.gsJm[szi_ex18]].szi_ex5;
                            let amt_total=Number(this.gsJson[i].amt_total);
                            let amt_total2=Number(this.gsJson[i].amt_total2);
                            this.gsJson[i].amt_total=amt_total+amt;
                            this.gsJson[i].amt_total2=amt_total2+amt;
                        }
                    }
                }catch(e){}
                if(szi_ex27){
                    let isOks=true;
                    for(let h=0;h<this.data.jzs.length;h++){
                        let jzi_ex32=this.data.jzs[h].jzi_ex32;
                        if(jzi_ex32==szi_id){
                            isOks=false;
                            break;
                        }
                    }
                    if(!isOks){
                        this.gsJson[i].szi_ex27s=this.gsJson[i].szi_ex27;
                        this.gsJson[i].szi_ex27="";
                    }
                }
                if(shows!="Y"&&szi_ex7.indexOf("减免")==-1){
                    let szi_ex35s=this.gsJson[i].szi_ex35s;
                    if(szi_ex35s){
                        szi_ex35s=Number(szi_ex35s);
                        let amt_ys2=this.gsJson[i].amt_ys2;
                        if(amt_ys2&&amt_ys2!="0"){
                            amt_ys2=Number(amt_ys2);
                            this.gsJson[i].amt_ys2=amt_ys2+szi_ex35s
                        }
                        
                    }
                    gsJson_.push(this.gsJson[i])
                }
            }
            this.gsJson2=gsJson_;
            console.log("this.glJson2==================")
            console.log(this.glJson2)
        },
        selectAll(){
             const that=this
             if(this.isCheck=="Y"||this.isCheck=='A'){
                  that.$nextTick(() => {
                    try{
                        for (let i = 0; i <that.glJson.length; i++) {
                            that.$refs.table1.toggleRowSelection(
                                that.glJson[i],
                                true
                            );
                        }
                        if(this.isCheck=='Y'||this.isCheck=='B'){
                            for (let i = 0; i <that.gsJson.length; i++) {
                                that.$refs.table2.toggleRowSelection(
                                    that.gsJson[i],
                                    true
                                );
                            }
                        }
                    }catch(e){}
                });
               

                this.data.jzItem=[];
                for(let i=0;i<this.data.gl.length;i++){
                    this.data.jzItem.push(this.data.gl[i]);
                }
                if(this.isCheck=='Y'||this.isCheck=='B'){
                    for(let i=0;i<this.gsJson.length;i++){
                        this.data.jzItem.push(this.gsJson[i]);
                    }
                }
             }
             this.fruitIdss=[];
            for(let i=0;i<this.glJson2.length;i++){
                this.fruitIdss.push("a"+i);
            }
            for(let i=0;i<this.gsJson2.length;i++){
                this.fruitIdss2.push("a"+i);
            }
            console.log(this.glJson2)
            console.log(this.fruitIdss,"this.frrusljsdlfjslkfjjlsdkfsd")
           // this.oldData.jzItem=JSON.parse(JSON.stringify(this.data.jzItem))
        },
        initData(){
            console.log("initData==================================================="+this.isFirst)
            console.log(this.data)
            if(this.isFirst!="Y"){
                this.glJson=this.data.gl;
                if(this.isShowGsxm=='Y')
                    this.gsJson=this.data.gs;
                
                 /*let glJson_=[];
                for(let i=0;i<this.glJson.length;i++){fruitIdss
                    let shows=this.glJson[i].shows;
                    let szi_ex7=this.glJson[i].szi_ex7;
                   
                    
                    if(shows!="Y"&&szi_ex7.indexOf("减免")==-1){

                        glJson_.push(this.glJson[i])
                    }
                }
                this.glJson2=glJson_;
               
                let gsJson_=[];
                for(let i=0;i<this.gsJson.length;i++){
                    let shows=this.gsJson[i].shows;
                    let szi_ex7=this.gsJson[i].szi_ex7;
                    if(shows!="Y"&&szi_ex7.indexOf("减免")==-1){
                        gsJson_.push(this.gsJson[i])
                    }
                }
                this.gsJson2=gsJson_;*/
                this.initList();
                this.selectAll();
                this.setJzItem()

            }
            this.isFirst="N";
            //this.selectAll();
        },
        loadYh(){
            this.$post("cemetery","/byg/funeral/getFuneralSfItem",{"type2":"优惠"}).then(data=>{
                let item=data.item;
                if(item.length>0){
                    this.yhItem=item[0];
                }
            })
        },
        select1(selection,index){
           // let selecttions=JSON.parse(JSON.stringify(selection))
            let idIndex = this.fruitIdss.indexOf('a'+index)
            if (idIndex >= 0) {
                // 如果已经包含了该id, 则去除(单选按钮由选中变为非选中状态)
                this.fruitIdss.splice(idIndex, 1);
             }else{
                  this.fruitIdss.push('a'+index)
             }
            
            this.setJzItem()
        },
        selectall1(selection){
            let selecttions=JSON.parse(JSON.stringify(selection))
            if(!this.checkAll){
                this.fruitIdss=[];
                
                for(let i=0;i<selecttions.length;i++){
                    this.fruitIdss.push("a"+i);
                }
            }else{
                this.fruitIdss=[];
            }
           
           
            this.setJzItem()
        },
        select2(selection,index){
           // let selecttions=JSON.parse(JSON.stringify(selection))
            let idIndex = this.fruitIdss2.indexOf('a'+index)
            if (idIndex >= 0) {
                // 如果已经包含了该id, 则去除(单选按钮由选中变为非选中状态)
                this.fruitIdss2.splice(idIndex, 1);
             }else{
                  this.fruitIdss2.push('a'+index)
             }
            
            this.setJzItem()
        },
        selectall2(selection){
            let selecttions=JSON.parse(JSON.stringify(selection))
            if(!this.checkAll){
                this.fruitIdss2=[];
                
                for(let i=0;i<selecttions.length;i++){
                    this.fruitIdss2.push("a"+i);
                }
            }else{
                this.fruitIdss2=[];
            }
           
           
            this.setJzItem()
        },
        setJzItem(){
            console.log("setJzItem=======================================")
            this.data.jzItem=[];
            let jz_ex6=0;//公司金额
            let jz_ex7=0;//管理金额
            let jz_ex6s=0;//公司金额
            let jz_ex7s=0;//管理金额
            let jz_recamt=0;//应收金额
            let jz_realamt=0;//实收金额
            let jz_ex14=0;//优惠金额
            let amt_total2=0;
            for(let i=0;i<this.fruitIdss.length;i++){
                let index=Number(this.fruitIdss[i].replace("a",""));
                let szi_ex18=this.glJson2[index].szi_ex18;
                let data_=JSON.parse(JSON.stringify(this.glJson2[index]))
                if(szi_ex18){
                    console.log(this.jzJson,"GSjSON==============")
                    
                    if(this.glJm[szi_ex18]||this.glJm[szi_ex18]==0){
                        let isOks=true;
                        for(let h=0;h<this.jzJson.length;h++){
                            let jzi_ex1=this.jzJson[h].jzi_ex1;
                            if(jzi_ex1==szi_ex18){
                                isOks=false;
                                break;
                            }
                        }
                        let index2=this.glJm[szi_ex18];
                        if(isOks){
                            this.data.jzItem.push(this.glJson[index2]);
                            let amt_=Number(this.glJson[index2].szi_ex5);
                            let amt_total=this.glJson2[index].amt_total;
                            amt_total=amt_total-amt_;
                            data_.amt_total=amt_total;
                        }

                        
                        
                    }
                }
                this.data.jzItem.push(data_)
                jz_ex7+=Number(this.glJson2[index].szi_ex5);
                jz_ex7s+=Number(this.glJson2[index].amt_total);
                jz_ex14+=Number(this.glJson2[index].szi_ex27);
                amt_total2+=Number(this.glJson2[index].amt_total2);
            }
            console.log("fruitIdss2======");
            console.log(this.fruitIdss2)
            for(let i=0;i<this.fruitIdss2.length;i++){
                let index=Number(this.fruitIdss2[i].replace("a",""));
                let szi_ex18=this.gsJson2[index].szi_ex18;
                let data_=JSON.parse(JSON.stringify(this.gsJson2[index]))
                if(szi_ex18){
                    if(this.gsJm[szi_ex18]||this.gsJm[szi_ex18]==0){
                         let isOks=true;
                        for(let h=0;h<this.jzJson.length;h++){
                            let jzi_ex1=this.jzJson[h].jzi_ex1;
                            if(jzi_ex1==szi_ex18){
                                isOks=false;
                                break;
                            }
                        }
                        if(isOks){
                            let index2=this.gsJm[szi_ex18];
                            this.data.jzItem.push(this.gsJson[index2]);
                            let amt_=Number(this.gsJson[index2].szi_ex5);
                            let amt_total=this.gsJson2[index].amt_total;
                            amt_total=amt_total-amt_;
                            data_.amt_total=amt_total;
                        }
                       
                    }
                }
                this.data.jzItem.push(data_)
                jz_ex7+=Number(this.gsJson2[index].szi_ex5);
                jz_ex7s+=Number(this.gsJson2[index].amt_total);
                jz_ex14+=Number(this.gsJson2[index].szi_ex27);
                amt_total2+=Number(this.gsJson2[index].amt_total2);
            }
            
            jz_recamt=jz_ex7s+jz_ex6s
            jz_realamt=jz_ex7s+jz_ex6s;
            console.log("jz_recatm========================"+jz_recamt+"="+jz_realamt);
           // alert(jz_realamt)
            this.$set(this.data["jz"][0],"jz_recamt",amt_total2 );
            this.$set(this.data["jz"][0],"jz_recamt2",amt_total2 );
            
            this.$set(this.data["jz"][0],"jz_realamt",jz_realamt);
            this.$set(this.data["jz"][0],"jz_ex6",jz_ex6);
            this.$set(this.data["jz"][0],"jz_ex7",jz_ex7);
            this.$set(this.data["jz"][0],"jz_ex14",jz_ex14);
            console.log(this.data.jzItem,"this.glJsonTemp==============================================")
        }
    },
    mounted(){
        let el=document.getElementsByClassName("el-table__footer-wrapper");
        for(let i=0;i<el.length;i++){
            let el2=el[i].getElementsByTagName("td");

            for(let j=0;j<el2.length;j++){
                el2[j].style.background="#66b1ff"
                el2[j].style.color="#66b1ff"
            }
        }
    },
    watch:{
        /*glJson:{
            handler: function (newVal) {
                let glJson_=[];
                for(let i=0;i<this.glJson.length;i++){
                    let shows=this.glJson[i].shows;
                    if(shows!="Y"){

                        glJson_.push(this.glJson[i])
                    }
                }
                this.glJson2=glJson_;
            },      
            deep: true    //深度监听
        },*/
        glJson2:{
             handler: function (newVal) {
                let totalAmt=0;
                console.log(this.fruitIdss,"thius.fursss")
                for(let i=0;i<this.fruitIdss.length;i++){
                    let index=this.fruitIdss[i].replace("a","");
                    index=Number(index);
                    console.log(this.glJson2,"this.glJson2=============")
                    let amt_total=this.glJson2[index]["amt_total"];
                    amt_total=amt_total=="" ? "0": amt_total;
                    let amt_ys2=this.glJson2[index]["amt_ys2"];
                    amt_ys2=amt_ys2=="" ? "0": amt_ys2;
                    totalAmt+=Number(amt_total)
                    amt_ys2=Number(amt_ys2)
                    this.glJson2[index]["amt_ys3"]=amt_ys2+Number(amt_total);
                    console.log("amt_yms33===="+this.glJson2[index]["amt_ys3"])
                    //console.log("amt_ys3==="+this.glJson[index]["amt_ys3"]+"="+amt_ys2+"="+this.glJson[index]["amt_total"])
                }
               
                this.data["jz"][0].jz_realamt=totalAmt;
                this.setJzItem();
            },      
            deep: true    //深度监听
        },
        gsJson2:{
             handler: function (newVal) {
                let totalAmt=0;
                for(let i=0;i<this.fruitIdss2.length;i++){
                    let index=this.fruitIdss2[i].replace("a","");
                    index=Number(index);
                    let amt_total=this.gsJson2[index]["amt_total"];
                    amt_total=amt_total=="" ? "0": amt_total;
                    let amt_ys2=this.gsJson2[index]["amt_ys2"];
                    amt_ys2=amt_ys2=="" ? "0": amt_ys2;
                    totalAmt+=Number(amt_total)
                    amt_ys2=Number(amt_ys2)
                    this.gsJson2[index]["amt_ys3"]=amt_ys2+Number(amt_total);
                    //console.log("amt_ys3==="+this.glJson[index]["amt_ys3"]+"="+amt_ys2+"="+this.glJson[index]["amt_total"])
                }
               
                this.data["jz"][0].jz_realamt=totalAmt;
                this.setJzItem();
            },      
            deep: true    //深度监听
        },
       /* gsJson:{
            handler: function (newVal) {
                let gsJson_=[];
                for(let i=0;i<this.gsJson.length;i++){
                    let shows=this.gsJson[i].shows;
                    if(shows!="Y"){
                        gsJson_.push(this.gsJson[i])
                    }
                }
                this.gsJson2=gsJson_;
            },      
            deep: true    //深度监听
        },*/
       
        data:{
            handler: function (newVal) {
                console.log("wathc====================");
                console.log(this.data)
                //this.glJson=this.data.gl;
                //this.gsJson=this.data.gs;

                /* let glJson_=[];
                for(let i=0;i<this.glJson.length;i++){
                    let shows=this.glJson[i].shows;
                    if(shows!="Y"){

                        glJson_.push(this.glJson[i])
                    }
                }
                this.glJson2=glJson_;*/

                /*let gsJson_=[];
                for(let i=0;i<this.gsJson.length;i++){
                    let shows=this.gsJson[i].shows;
                    if(shows!="Y"){
                        gsJson_.push(this.gsJson[i])
                    }
                }
                this.gsJson2=gsJson_;*/
                let jzJson_=[];
                let totals=0;
                for(let i=0;i<this.data.jzs.length;i++){
                    let shows=this.data.jzs[i].shows;
                    let amt_total=this.data.jzs[i].amt_total;
                    if(shows!="Y"){
                        jzJson_.push(this.data.jzs[i])
                        totals+=Number(amt_total)
                    }
                }
                let jz_={
                    szi_ex1:"合计",
                    amt_total:totals
                }
                jzJson_.push(jz_)
                this.jzJson=jzJson_;
                console.log("jzJson------------");
                console.log(jzJson_)
               // this.jzJson=jzJson_;
               /* if(this.data["jz"][0].jz_ex13&&this.data["jz"][0].jz_ex13!=this.yh){
                    this.yh=this.data["jz"][0].jz_ex13;
                    this.yhItem.szi_ex2="-"+this.yh;
                    this.yhItem.szi_ex5="-"+this.yh;
                    let index=-1;
                    for(let i=0;i<this.data["jzItem"].length;i++){
                        if(this.data["jzItem"][i].szi_ex7=="优惠"){
                            index=i;
                        }
                    }
                    if(index==-1){
                        index=this.data["jzItem"].length;
                    }
                    this.$set(this.data["jzItem"],index,this.yhItem);
                }
                console.log("items============================");
                console.log(this.yhItem)
               
                */
            },      
            deep: true    //深度监听
        }
    }
}
</script>
<style scoped>
.checkout_list{
    height:100%;
    width:100%;
}
.el-table__footer-wrapper tbody td{
    color:red;
    background-color:#66b1ff;
}
.tds{
    border:1px solid #ddd;
    padding:5px;
}
</style>